package com.sheng.whyclass.person.activity;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.sheng.util.Constant;
import com.sheng.whyclass.R;

public class StudentInfoAcitivity extends Activity {


    private String id;
    private String name;
    private String className;
    private String department;

    private TextView userTV;
    private TextView userName;
    private TextView classrTV;
    private TextView userClass;
    private TextView idTV;
    private TextView userId;
    private TextView departmentTV;
    private TextView userDepartment;


    public static void startStudentInfoAcitivity(Context context, String className, String name, String id, String department) {
        Intent intent = new Intent(context, StudentInfoAcitivity.class);
        Bundle b = new Bundle();
        b.putString(Constant.KEY_CONTENT_ID, id);
        b.putString(Constant.USER, name);
        b.putString(Constant.CLASS, className);
        b.putString(Constant.DEPARTMENT, department);
        intent.putExtras(b);
        context.startActivity(intent);
    }

    private void perseIntent() {
        Intent intent = getIntent();
        if (intent == null || intent.getExtras() == null) {
            return;
        }

        Bundle b = intent.getExtras();
        id = b.getString(Constant.KEY_CONTENT_ID);
        name = b.getString(Constant.USER);
        className = b.getString(Constant.CLASS);
        department = b.getString(Constant.DEPARTMENT);
    }


    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_student_info_acitivity);
        perseIntent();
        initView();
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
    }


    private void initView() {
        userTV = (TextView) findViewById(R.id.userTV);
        userName = (TextView) findViewById(R.id.user_name);
        userName.setText(name);
        classrTV = (TextView) findViewById(R.id.classrTV);
        userClass = (TextView) findViewById(R.id.user_class);
        userClass.setText(className);
        idTV = (TextView) findViewById(R.id.idTV);
        userId = (TextView) findViewById(R.id.user_id);
        userId.setText(id);
        departmentTV = (TextView) findViewById(R.id.departmentTV);
        userDepartment = (TextView) findViewById(R.id.user_department);
        userDepartment.setText(department);
    }




}
